<template>
  <div>
    <el-dialog
      :title="$t('select_the_employee1')"
      :visible.sync="open"
      width="800px"
      append-to-body
    >
      <!-- <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      
    >
      <el-form-item prop="employeeName">
        <el-input
          v-model="queryParams.employeeName"
          placeholder="请输入雇员姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item  prop="phone">
        <el-input
          v-model="queryParams.phone"
          placeholder="请输入雇员姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form> -->

      <el-table v-loading="loading" :data="tableList" border :max-height="tableHeight">
        <el-table-column
          :label="$t('name')"
          align="center"
          prop="employeeName"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          :label="$t('mobile_number')"
          align="center"
          prop="phone"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          :label="$t('emailbox')"
          align="center"
          prop="email"
          :show-overflow-tooltip="true"
        />

        <el-table-column
          :label="$t('action')"
          align="center"
          class-name="small-padding fixed-width"
          width="240"
        >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              @click="handleCheck(scope.row)"
              >{{ $t("select") }}</el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <!-- <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    /> -->
    </el-dialog>
  </div>
</template>

<script>
import { getEmpListBySalaryGroup } from "@/api/salary/salaryCalculation";
export default {
  props: {
    salaryCalculationId: {
      type: [String, Number],
    },
    employerId: {
      type: [String, Number],
    },
  },
  data() {
    return {
      loading: false,
      open: false,
      total: 0,
      tableList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        employeeName: undefined,
        phone: undefined,
      },
    };
  },
  created() {},

  methods: {
    showModal() {
      this.open = true;
      this.queryParams.pageNum = 1;
      this.getList();
    },
    closeModal() {
      this.open = false;
    },
    getList() {
      this.loading = true;
      getEmpListBySalaryGroup({
        employerId: this.employerId,
        salaryCalculationId: this.salaryCalculationId,
      }).then((res) => {
        this.tableList = res.data || [];
        this.total = this.tableList.length;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleCheck(row) {
      this.$emit("handleCheck", row);
    },
  },
};
</script>
<style scoped lang="scss">
.input-block {
  display: flex;
  align-items: center;
}
</style>
